/**
 * Created by umakr on 2018/5/8.
 */
import {
  updateFeedback ,listFeedback ,getLotteryInfoById,deleteLottery,listLotteryResultById,informWinUser
} from '../services/feedback';
import { routerRedux } from 'dva/router';

export default {
  namespace: 'feedback',

  state: {
    index:0,
    loading: true,
    checkUserListData:[],
  },

  effects: {
    *updateFeedback({payload ,callback}, { call, put }) {
      yield put({
        type: 'changeLoading',
        payload: true,
      });
      const response = yield call(updateFeedback,payload);
      yield put({
        type: 'changeLoading',
        payload: false,
      });
      callback(response)
    },

    *listFeedback({payload,callback}, {call, put }) {
      yield put({
        type: 'changeLoading',
        payload: true,
      });
      const response = yield call(listFeedback,payload);
      yield put({
        type: 'changeLoading',
        payload: false,
      });
      callback(response)
    },
  },


  reducers: {
    listSpreadByType(state, action) {
      return {
        ...state,
        spreadListData: action.payload.list,
      };
    },
    changeLoading(state, action) {
      return {
        ...state,
        loading: action.payload,
      };
    },
  }
};
